﻿@{
    var list = ViewBag.TypeList as IList<ProductPartitionInfo>;
    if (list != null)
    {
        var len = list.Count;
        for (var i = 0; i < len; i += 6)
        {
            var temp = list.Skip(i).Take(6).ToList();   
    <ul class="list-tags">
        @{
            var tLen = temp.Count;
            for (var m = 0; m < tLen; m++)
            {
                var pFirst = m % 3 == 0 ? "first-col" : string.Empty;
            <li class="list-item @pFirst">
                <div class="cell-tags">
                    <h3 class="fd-left"><a title="@temp[m].Name" href="javascript:void(0);">@temp[m].Name</a></h3>
                    <ul>
                        @{
                var children = temp[m].Children;
                if (children != null)
                {
                    var clen = children.Count > 3 ? 3 : children.Count;
                    for (var k = 0; k < clen; k++)
                    {
                        var className = k == 0 ? "first-col" : string.Empty;
                        <li  class="@className">
                            <a title="@children[k].Name" 
                                href='@Url.Action("Products", "Default", new { partitionId = children[k].PartitionId })'>@children[k].Name</a>
                        </li>    
                    }
                }
                        }
                    </ul>
                </div>
            </li>
            }
        }
    </ul>
        }
    }

}